import { addWithdrawApi, getWithdrawApi } from "../../utils/serviceApiUrl.js";
const WITHDRAW_LIST = "WITHDRAW_LIST";
const state = {
    withdrawList: null
};

const getters = {
    withdrawList(state) {
        return state.withdrawList;
    }
};

const actions = {
    getWithdrawList({ commit }, param) {
        getWithdrawApi(param).then((res) => {
            if (res.code == 0) {
                commit(WITHDRAW_LIST, res);
            }
        });
    },
    // eslint-disable-next-line no-unused-vars
    addWithdraw({ commit }, param) {
        return new Promise((resolve, reject) => {
            addWithdrawApi(param).then((res) => {
                if (res.code == 0) {
                    resolve(res.rs);
                } else {
                    reject(res.messages);
                }
            });
        });
    }
};
const mutations = {
    [WITHDRAW_LIST](state, data) {
        state.withdrawList = data.rs;
    }
};

export default {
    state,
    getters,
    actions,
    mutations
};
